﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Xml.Linq;
using PSE.ProcessManager.Entity;
using System.Globalization;
using PSE.Framework.Configuration;

namespace PSE.ProcessManager.ConfigurationManager
{
    public class ConfigurationManager
    {
        public const string INTELIGENCE_MANAGER_CONFIG = "InteligenceManager.exe.config";
        public const string INTELIGENCE_MANAGER_INSTANCE_CONFIG = "InteligenceManagerInstance.exe.config";
        public const string EXECUTOR_CONFIG = "Executor.exe.config";

        private string _processManagerPath = null;
        /// <summary>
        /// Caminho de instalação do Process Manager
        /// </summary>
        public string ProcessManagerPath
        {
            get { return _processManagerPath; }
        }

        /// <summary>
        /// Construtor padrão
        /// </summary>
        public ConfigurationManager()
        {
            _processManagerPath = Path.Combine(ApplicationConfiguration.GetApplicationRootDirectory(PSE.Framework.Configuration.Components.SystemComponents.System), "ProcessManager");

            if (!Directory.Exists(_processManagerPath))
                throw new DirectoryNotFoundException(string.Format("Process Manager path '{0}' not found", _processManagerPath));
        }

        /// <summary>
        /// Cria um produto
        /// </summary>
        /// <param name="productName">Nome do produto</param>
        /// <returns>true se conseguiu criar o produto, false se o produto já existe</returns>
        public bool AddProduct(string productName)
        {
            bool ret = false;

            if (string.IsNullOrEmpty(productName))
                throw new ArgumentNullException("productName");

            string outputPath = Path.Combine(_processManagerPath, "Server");

            string configPath = Path.Combine(outputPath, INTELIGENCE_MANAGER_CONFIG);

            if (!File.Exists(configPath))
                throw new Exception(string.Format("Config file '{0}' not found", configPath));

            // Altera o config para incluir o produto
            XDocument config = XDocument.Load(configPath);

            var productConfiguration = from p in config.Descendants()
                                       where p.Name.LocalName == "productConfiguration"
                                       select p;

            if (productConfiguration.Count() > 0)
            {
                // Verifica se já existe uma tag para o produto
                if (!(from p in productConfiguration.First().Descendants()
                      where p.Name.LocalName == "product" &&
                            p.Attribute("id") != null &&
                            p.Attribute("id").Value.ToUpper() == productName.ToUpper()
                      select p).Any())
                {
                    if (productConfiguration.First().Element("products") == null)
                        productConfiguration.First().Add(new XElement("products"));

                    XElement product = new XElement("product");
                    product.SetAttributeValue("id", productName);
                    productConfiguration.First().Element("products").Add(product);

                    ret = true;
                }
            }
            else
            {
                throw new Exception(string.Format("'productConfiguration' section not found in config file '{0}'", configPath));
            }

            string dirPath = outputPath + @"\Instances";
            CreateDirectory(dirPath);

            string productInstancesDirPath = dirPath + @"\" + productName;

            if (!Directory.Exists(productInstancesDirPath))
            {
                //criar diretório para o produto
                Directory.CreateDirectory(productInstancesDirPath);

                ret = true;
            }

            if (ret)
            {
                config.Save(configPath);
            }

            return ret;
        }

        /// <summary>
        /// Exclui um produto
        /// </summary>
        /// <param name="productName">Nome do produto</param>
        /// <returns>true se conseguiu excluir o produto, false se o produto não existe</returns>
        public bool RemoveProduct(string productName)
        {
            if (string.IsNullOrEmpty(productName))
                throw new ArgumentNullException("productName");

            string outputPath = Path.Combine(_processManagerPath, "Server");

            string configPath = Path.Combine(outputPath, INTELIGENCE_MANAGER_CONFIG);

            if (!File.Exists(configPath))
                throw new Exception(string.Format("Config file '{0}' not found", configPath));

            // Altera o config para excluir o produto
            XDocument config = XDocument.Load(configPath);

            var productConfiguration = from p in config.Descendants()
                                       where p.Name.LocalName == "productConfiguration"
                                       select p;

            if (productConfiguration.Count() > 0)
            {
                var product = from p in productConfiguration.First().Descendants()
                              where p.Name.LocalName == "product" &&
                                    p.Attribute("id") != null &&
                                    p.Attribute("id").Value.ToUpper() == productName.ToUpper()
                              select p;

                // Verifica se já existe uma tag para o produto
                if (product.Count() > 0)
                {
                    product.First().Remove();

                    config.Save(configPath);
                }
            }
            else
            {
                throw new Exception(string.Format("'productConfiguration' section not found in config file '{0}'", configPath));
            }

            string dirPath = outputPath + @"\Instances";
            string productInstancesDirPath = dirPath + @"\" + productName;

            if (Directory.Exists(productInstancesDirPath))
            {
                Directory.Delete(productInstancesDirPath, true);

                return true;
            }

            return false;
        }

        /// <summary>
        /// Lista todos os produtos instalados
        /// </summary>
        /// <returns>Lista dos produtos</returns>
        public List<string> ListProducts()
        {
            string serverPath = Path.Combine(_processManagerPath, "Server");

            List<string> ret = new List<string>();
            List<string> products = InternalListProducts();

            foreach (string product in products)
            {
                // Captura a pasta do produto
                string productInstancesDirPath = Path.Combine(Path.Combine(serverPath, "Instances"), product);
                string instancesFile = Path.Combine(productInstancesDirPath, "Instances.config");

                if (Directory.Exists(productInstancesDirPath) &&
                    File.Exists(instancesFile))
                {
                    ret.Add(product);
                }
            }

            return ret;

        }

        private List<string> InternalListProducts()
        {
            List<string> ret = new List<string>();

            string serverPath = Path.Combine(_processManagerPath, "Server");
            string configPath = Path.Combine(serverPath, INTELIGENCE_MANAGER_CONFIG);

            if (!File.Exists(configPath))
                throw new Exception(string.Format("Config file '{0}' not found", configPath));

            XDocument config = XDocument.Load(configPath);

            var productConfiguration = from p in config.Descendants()
                                       where p.Name.LocalName == "productConfiguration"
                                       select p;

            if (productConfiguration.Count() > 0)
            {
                var products = from p in productConfiguration.First().Descendants()
                               where p.Name.LocalName == "product" &&
                                     p.Attribute("id") != null
                               select p.Attribute("id").Value;

                return products.ToList();
            }
            else
            {
                throw new Exception(string.Format("'productConfiguration' section not found in config file '{0}'", configPath));
            }
        }

        /// <summary>
        /// Adiciona uma instância
        /// </summary>
        /// <param name="productName">Nome do produto</param>
        /// <param name="instanceName">Nome da instância</param>
        /// <param name="instanceAddress">Endereço da instância</param>
        /// <param name="processPath">Caminho dos processos</param>
        /// <param name="stsAuthorityCertificateName">Nome do certificado de STS</param>
        /// <param name="serviceCertificateName">Nome do certificado de serviços</param>
        /// <returns>true se conseguiu adicionar, false se instância já existe</returns>
        public bool AddInstance(string productName,
                                string instanceName,
                                string instanceAddress,
                                string processPath,
                                string stsAuthorityCertificateName,
                                string serviceCertificateName)
        {
            return AddInstance(productName, instanceName, instanceAddress, processPath, stsAuthorityCertificateName, serviceCertificateName, ListInteligenceModules());
        }

        /// <summary>
        /// Adiciona uma instância
        /// </summary>
        /// <param name="productName">Nome do produto</param>
        /// <param name="instanceName">Nome da instância</param>
        /// <param name="instanceAddress">Endereço da instância</param>
        /// <param name="processPath">Caminho dos processos</param>
        /// <param name="stsAuthorityCertificateName">Nome do certificado de STS</param>
        /// <param name="serviceCertificateName">Nome do certificado de serviços</param>
        /// <param name="inteligenceModules">Inteligence modules</param>
        /// <returns>true se conseguiu adicionar, false se instância já existe</returns>
        public bool AddInstance(string productName,
                                string instanceName,
                                string instanceAddress,
                                string processPath,
                                string stsAuthorityCertificateName,
                                string serviceCertificateName,
                                List<InteligenceModuleEntity> inteligenceModules)
        {
            if (string.IsNullOrEmpty(productName))
                throw new ArgumentNullException("productName");
            if (!this.InternalListProducts().Any(p => p.ToUpper() == productName.ToUpper()))
                throw new ArgumentException(string.Format("Invalid product name '{0}'", productName), "productName");

            if (string.IsNullOrEmpty(instanceName))
                throw new ArgumentNullException("instanceName");
            if (string.IsNullOrEmpty(instanceAddress))
                throw new ArgumentNullException("instanceAddress");

            if (string.IsNullOrEmpty(processPath))
                throw new ArgumentNullException("processPath");
            if (!Directory.Exists(processPath))
                throw new ArgumentException(string.Format("Process path not found '{0}'", processPath), "processPath");

            if (string.IsNullOrEmpty(stsAuthorityCertificateName))
                throw new ArgumentNullException("stsAuthorityCertificateName");
            if (string.IsNullOrEmpty(serviceCertificateName))
                throw new ArgumentNullException("serviceCertificateName");
            if (inteligenceModules == null || inteligenceModules.Count == 0)
                throw new ArgumentNullException("inteligenceModules");


            // Captura a pasta do produto
            string productInstancesDirPath = _processManagerPath + @"\Server\Instances\" + productName;

            //if (!Directory.Exists(productInstancesDirPath))
            //    throw new Exception(string.Format("Product path not found '{0}'", productInstancesDirPath));
            if (!Directory.Exists(productInstancesDirPath))
                Directory.CreateDirectory(productInstancesDirPath);

            string instanceDirPath, dataFilesDirPath;
            List<InstanceEntity> instancesToExport = new List<InstanceEntity>();

            string instancesFile = productInstancesDirPath + @"\Instances.config";

            PSE.Framework.Serialization.XmlSerializer serializer = new PSE.Framework.Serialization.XmlSerializer(typeof(List<InstanceEntity>));

            // Tenta abrir o arquivo de instancias
            if (File.Exists(instancesFile))
                instancesToExport = serializer.DeserializeFromFile<List<InstanceEntity>>(instancesFile);

            if (!instancesToExport.Any(i => i.Name == instanceName))
            {
                //criar diretorio para armazenar os configs da instancia e os arquivos de dados
                instanceDirPath = productInstancesDirPath + @"\" + instanceName;
                CreateDirectory(instanceDirPath);

                //criar configs
                //criar config inteligence manager
                GenerateInteligenceManagerConfig(productName, instanceName, instanceAddress, instanceDirPath, stsAuthorityCertificateName, serviceCertificateName, processPath);
                //criar config executor
                GenerateExecutorConfig(processPath, instanceDirPath);

                //criar diretorios para armazenar arquivos de dados
                dataFilesDirPath = instanceDirPath + @"\Data\Files";
                CreateDirectory(dataFilesDirPath);

                PSE.ProcessManager.Entity.InstanceEntity instanceEntity = new PSE.ProcessManager.Entity.InstanceEntity();
                instanceEntity.Name = instanceName;
                instanceEntity.Address = instanceAddress;

                instancesToExport.Add(instanceEntity);

                //gerar arquivo com inteligence modules
                ExportInteligenceModules(inteligenceModules, dataFilesDirPath);

                serializer.SerializeToFile(instancesFile, instancesToExport);

                return true;
            }

            return false;
        }

        /// <summary>
        /// Exclui uma instância
        /// </summary>
        /// <param name="productName">Nome do produto</param>
        /// <param name="instanceName">Nome da instância</param>
        /// <returns>true se conseguiu excluir, false se a instância não existe</returns>
        public bool RemoveInstance(string productName, string instanceName)
        {
            if (string.IsNullOrEmpty(productName))
                throw new ArgumentNullException("productName");
            if (!this.InternalListProducts().Any(p => p.ToUpper() == productName.ToUpper()))
                throw new ArgumentException(string.Format("Invalid product name '{0}'", productName), "productName");

            if (string.IsNullOrEmpty(instanceName))
                throw new ArgumentNullException("instanceName");


            // Captura a pasta do produto
            string productInstancesDirPath = _processManagerPath + @"\Server\Instances\" + productName;

            if (!Directory.Exists(productInstancesDirPath))
                throw new Exception(string.Format("Product path not found '{0}'", productInstancesDirPath));

            string instanceDirPath;
            List<InstanceEntity> instancesToExport = new List<InstanceEntity>();

            string instancesFile = productInstancesDirPath + @"\Instances.config";

            PSE.Framework.Serialization.XmlSerializer serializer = new PSE.Framework.Serialization.XmlSerializer(typeof(List<InstanceEntity>));

            // Tenta abrir o arquivo de instancias
            if (File.Exists(instancesFile))
            {
                instancesToExport = serializer.DeserializeFromFile<List<InstanceEntity>>(instancesFile);

                if (instancesToExport.Any(i => i.Name == instanceName))
                    instancesToExport.RemoveAll(i => i.Name == instanceName);

                if (instancesToExport.Count > 0)
                    serializer.SerializeToFile(instancesFile, instancesToExport);
                else
                    File.Delete(instancesFile);
            }
            else
            {
                throw new Exception(string.Format("Instances file not found '{0}'", instancesFile));
            }

            //criar diretorio para armazenar os configs da instancia e os arquivos de dados
            instanceDirPath = productInstancesDirPath + @"\" + instanceName;

            if (Directory.Exists(instanceDirPath))
            {
                Directory.Delete(instanceDirPath, true);

                return true;
            }

            return false;
        }

        /// <summary>
        /// Lista as instâncias de um produto
        /// </summary>
        /// <param name="productName">Nome do produto</param>
        /// <returns>Lista de instâncias</returns>
        public List<InstanceEntity> ListInstances(string productName)
        {
            if (string.IsNullOrEmpty(productName))
                throw new ArgumentNullException("productName");
            if (!this.InternalListProducts().Any(p => p.ToUpper() == productName.ToUpper()))
                throw new ArgumentException(string.Format("Invalid product name '{0}'", productName), "productName");


            // Captura a pasta do produto
            string productInstancesDirPath = _processManagerPath + @"\Server\Instances\" + productName;

            if (!Directory.Exists(productInstancesDirPath))
                throw new Exception(string.Format("Product path not found '{0}'", productInstancesDirPath));

            List<InstanceEntity> instances = new List<InstanceEntity>();

            string instancesFile = productInstancesDirPath + @"\Instances.config";

            PSE.Framework.Serialization.XmlSerializer serializer = new PSE.Framework.Serialization.XmlSerializer(typeof(List<InstanceEntity>));

            // Tenta abrir o arquivo de instancias
            if (File.Exists(instancesFile))
            {
                instances = serializer.DeserializeFromFile<List<InstanceEntity>>(instancesFile);
            }

            return instances;
        }

        public bool AddProcess(string productName, string instanceName, ProcessEntity process)
        {
            if (string.IsNullOrEmpty(productName))
                throw new ArgumentNullException("productName");
            if (!this.InternalListProducts().Any(p => p.ToUpper() == productName.ToUpper()))
                throw new ArgumentException(string.Format("Invalid product name '{0}'", productName), "productName");

            if (string.IsNullOrEmpty(instanceName))
                throw new ArgumentNullException("instanceName");
            if (process == null)
                throw new ArgumentNullException("process");


            // Captura a pasta do produto
            string productInstancesDirPath = _processManagerPath + @"\Server\Instances\" + productName;

            if (!Directory.Exists(productInstancesDirPath))
                throw new Exception(string.Format("Product path not found '{0}'", productInstancesDirPath));

            string instanceDirPath, dataFilesDirPath, processFile;
            List<InstanceEntity> instancesToExport = new List<InstanceEntity>();
            List<ProcessEntity> processToExport = new List<ProcessEntity>();

            string instancesFile = productInstancesDirPath + @"\Instances.config";

            PSE.Framework.Serialization.XmlSerializer instanceSerializer = new PSE.Framework.Serialization.XmlSerializer(typeof(List<InstanceEntity>));
            PSE.Framework.Serialization.XmlSerializer processSerializer = new PSE.Framework.Serialization.XmlSerializer(typeof(List<ProcessEntity>));

            // Tenta abrir o arquivo de instancias
            if (File.Exists(instancesFile))
                instancesToExport = instanceSerializer.DeserializeFromFile<List<InstanceEntity>>(instancesFile);
            else
                throw new Exception(string.Format("Instances file not found '{0}'", instancesFile));

            if (instancesToExport.Any(i => i.Name == instanceName))
            {
                InstanceEntity instance = instancesToExport.First(i => i.Name == instanceName);

                // Tenta adicionar o processo ao arquivo de instâncias
                if (!instance.ProcessIds.Any(p => p == process.Id))
                    instance.ProcessIds.Add((int)process.Id);
                else
                    return false;

                //criar diretorio para armazenar os configs da instancia e os arquivos de dados
                instanceDirPath = productInstancesDirPath + @"\" + instanceName;

                //criar diretorios para armazenar arquivos de dados
                dataFilesDirPath = instanceDirPath + @"\Data\Files";

                processFile = dataFilesDirPath + @"\Processes.xml";

                if (File.Exists(processFile))
                    processToExport = processSerializer.DeserializeFromFile<List<ProcessEntity>>(processFile);

                // Tenta adicionar o processo ao arquivo de processos
                if (!processToExport.Any(p => p.Id == process.Id))
                    processToExport.Add(process);
                else
                    return false;

                // Se conseguiu adicionar nos dois arquivos, salva
                instanceSerializer.SerializeToFile(instancesFile, instancesToExport);
                processSerializer.SerializeToFile(processFile, processToExport);

                return true;
            }
            else
                throw new Exception(string.Format("Instance not found '{0}'", instanceName));
        }

        public bool RemoveProcess(string productName, string instanceName, int processId)
        {
            if (string.IsNullOrEmpty(productName))
                throw new ArgumentNullException("productName");
            if (!this.InternalListProducts().Any(p => p.ToUpper() == productName.ToUpper()))
                throw new ArgumentException(string.Format("Invalid product name '{0}'", productName), "productName");

            if (string.IsNullOrEmpty(instanceName))
                throw new ArgumentNullException("instanceName");
            if (processId <= 0)
                throw new ArgumentOutOfRangeException("processId");


            // Captura a pasta do produto
            string productInstancesDirPath = _processManagerPath + @"\Server\Instances\" + productName;

            if (!Directory.Exists(productInstancesDirPath))
                throw new Exception(string.Format("Product path not found '{0}'", productInstancesDirPath));

            string instanceDirPath, dataFilesDirPath, processFile;
            List<InstanceEntity> instancesToExport = new List<InstanceEntity>();
            List<ProcessEntity> processToExport = new List<ProcessEntity>();

            string instancesFile = productInstancesDirPath + @"\Instances.config";

            PSE.Framework.Serialization.XmlSerializer instanceSerializer = new PSE.Framework.Serialization.XmlSerializer(typeof(List<InstanceEntity>));
            PSE.Framework.Serialization.XmlSerializer processSerializer = new PSE.Framework.Serialization.XmlSerializer(typeof(List<ProcessEntity>));

            // Tenta abrir o arquivo de instancias
            if (File.Exists(instancesFile))
                instancesToExport = instanceSerializer.DeserializeFromFile<List<InstanceEntity>>(instancesFile);
            else
                throw new Exception(string.Format("Instances file not found '{0}'", instancesFile));

            if (instancesToExport.Any(i => i.Name == instanceName))
            {
                InstanceEntity instance = instancesToExport.First(i => i.Name == instanceName);

                // Tenta remover o processo do arquivo de instâncias
                if (instance.ProcessIds.Any(p => p == processId))
                    instance.ProcessIds.Remove((int)processId);

                // Salva arquivo de instâncias
                instanceSerializer.SerializeToFile(instancesFile, instancesToExport);

                //criar diretorio para armazenar os configs da instancia e os arquivos de dados
                instanceDirPath = productInstancesDirPath + @"\" + instanceName;

                //criar diretorios para armazenar arquivos de dados
                dataFilesDirPath = instanceDirPath + @"\Data\Files";

                processFile = dataFilesDirPath + @"\Processes.xml";

                if (File.Exists(processFile))
                    processToExport = processSerializer.DeserializeFromFile<List<ProcessEntity>>(processFile);

                // Tenta remover o processo do arquivo de processos
                if (processToExport.Any(p => p.Id == processId))
                    processToExport.RemoveAll(p => p.Id == processId);
                else
                    return false;

                // Salva arquivo de processos
                if (processToExport.Count > 0)
                    processSerializer.SerializeToFile(processFile, processToExport);
                else if (File.Exists(processFile))
                    File.Delete(processFile);

                return true;
            }
            else
                throw new Exception(string.Format("Instance not found '{0}'", instanceName));
        }

        public List<ProcessEntity> ListProcesses(string productName, string instanceName)
        {
            if (string.IsNullOrEmpty(productName))
                throw new ArgumentNullException("productName");
            if (!this.InternalListProducts().Any(p => p.ToUpper() == productName.ToUpper()))
                throw new ArgumentException(string.Format("Invalid product name '{0}'", productName), "productName");

            if (string.IsNullOrEmpty(instanceName))
                throw new ArgumentNullException("instanceName");


            // Captura a pasta do produto
            string productInstancesDirPath = _processManagerPath + @"\Server\Instances\" + productName;

            if (!Directory.Exists(productInstancesDirPath))
                throw new Exception(string.Format("Product path not found '{0}'", productInstancesDirPath));

            string instanceDirPath, dataFilesDirPath, processFile;
            List<ProcessEntity> processToExport = new List<ProcessEntity>();

            PSE.Framework.Serialization.XmlSerializer processSerializer = new PSE.Framework.Serialization.XmlSerializer(typeof(List<ProcessEntity>));

            //criar diretorio para armazenar os configs da instancia e os arquivos de dados
            instanceDirPath = productInstancesDirPath + @"\" + instanceName;

            //criar diretorios para armazenar arquivos de dados
            dataFilesDirPath = instanceDirPath + @"\Data\Files";

            processFile = dataFilesDirPath + @"\Processes.xml";

            // Tenta abrir o arquivo de processos
            if (File.Exists(processFile))
                processToExport = processSerializer.DeserializeFromFile<List<ProcessEntity>>(processFile);

            return processToExport;
        }

        private void CreateDirectory(string dirPath)
        {
            if (!Directory.Exists(dirPath))
                Directory.CreateDirectory(dirPath);
        }

        private void GenerateInteligenceManagerConfig(string productName, string instanceName, string instanceAddress, string instanceDirPath, string stsAuthorityCertificateName, string serviceCertificateName, string processPath)
        {
            StringBuilder sb = new StringBuilder(ConfigTemplates.InteligenceManagerConfig);
            sb.Replace("[PSEProcessManagerInstallPath]", _processManagerPath);
            sb.Replace("[ProductName]", productName);
            sb.Replace("[InstanceName]", instanceName);
            sb.Replace("[STSAuthorityCertificate]", stsAuthorityCertificateName);
            sb.Replace("[ServiceCertificate]", serviceCertificateName);
            sb.Replace("[TcpInstanceAddress]", instanceAddress);
            sb.Replace("[ProcessesFolderPath]", processPath);
            File.WriteAllText(Path.Combine(instanceDirPath, INTELIGENCE_MANAGER_INSTANCE_CONFIG), sb.ToString());
        }

        private void GenerateExecutorConfig(string processPath, string instanceDirPath)
        {
            StringBuilder sb = new StringBuilder(ConfigTemplates.ExecutorConfig);
            sb.Replace("[ProcessesFolderPath]", processPath);
            File.WriteAllText(Path.Combine(instanceDirPath, EXECUTOR_CONFIG), sb.ToString());
        }

        /// <summary>
        /// Exportar os inteligence modules
        /// </summary>
        /// <param name="dataFilesDirPath"></param>
        private void ExportInteligenceModules(List<InteligenceModuleEntity> inteligenceModules, string dataFilesDirPath)
        {
            PSE.Framework.Serialization.XmlSerializer serializer = new PSE.Framework.Serialization.XmlSerializer(typeof(List<InteligenceModuleEntity>));
            serializer.SerializeToFile(dataFilesDirPath + @"\InteligenceModules.xml", inteligenceModules);
        }

        /// <summary>
        /// Retorna a lista de inteligence modules
        /// </summary>
        /// <param name="dataFilesDirPath"></param>
        public List<InteligenceModuleEntity> ListInteligenceModules()
        {
            return new List<PSE.ProcessManager.Entity.InteligenceModuleEntity>()
            {
                new PSE.ProcessManager.Entity.InteligenceModuleEntity()
                {
                    Id = 1,
                    Name = "SimpleExecutionInteligenceModule",
                    Description = "Inteligence Module para execução de apenas um método.",
                    Assembly = "PSE.ProcessManager.Server.InteligenceModules",
                    Class = "SimpleExecutionInteligenceModule"
                },

                new PSE.ProcessManager.Entity.InteligenceModuleEntity()
                {
                    Id = 2,
                    Name = "ServiceInteligenceModule",
                    Description = "Inteligence Module para execução de um processo como serviço. (start e stop)",
                    Assembly = "PSE.ProcessManager.Server.InteligenceModules",
                    Class = "ServiceInteligenceModule"
                }
            };
        }
    }
}